package com.yohann.designPattern.command;

/**
 * <p>
 * 关灯命令
 * </p>
 *
 * @author Yohann
 * @since 2021/2/11 16:31
 */
public class LightOffCommand implements Command {
    private LightReceiver lightReceiver;

    public LightOffCommand(LightReceiver lightReceiver) {
        this.lightReceiver = lightReceiver;
    }

    @Override
    public void execute() {
        lightReceiver.off();
    }

    @Override
    public void undo() {
        lightReceiver.on();
    }
}